// 定义 field: type,
struct Player {
    name: String,
    iq: u8,
    friends: u8,
    score: u16,
}
// 结构体大小是其每个成员字段的总和
fn main() {
    let name = "Alice".to_string();
    let player = Player {
        name,
        iq: 171,
        friends: 134,
        score: 1129,
    };

    bump_player_score(player, 120);
}

// mut修饰player，表示其所有字段都可以修改
fn bump_player_score(mut player: Player, score: u16) {
    player.score += score;
    println!("Update player stats: ");
    println!("Name: {}", player.name);
    println!("IQ: {}", player.iq);
    println!("Friends: {}", player.friends);
    println!("Score: {}", player.score);
}